#!/usr/bin/python
# -*- coding: utf-8 -*-
import httplib2
from urllib.parse import urlencode  # python3
# from urllib import urlencode #python2
params = urlencode({'ip': '9.8.8.8', 'datatype': 'jsonp', 'callback': 'find'})#修改ip的传入准则
url = 'https://api.ip138.com/ip/?' + params
headers = {"token": "fff157df08f78939102a31910b63ab93"}  # token已经修改
http = httplib2.Http()
response, content = http.request(url, 'GET', headers=headers)
print(content.decode("utf-8"))